<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单详情</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        :root {
            --primary-color: #1989fa;
            --bg-color: #f5f5f5;
            --card-bg: #fff;
            --text-color: #333;
            --border-color: #eee;
            --success-color: #52c41a;
            --warning-color: #faad14;
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: var(--bg-color);
            color: var(--text-color);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }
        .header {
            padding: 15px;
            background-color: var(--primary-color);
            color: white;
            display: flex;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 100;
        }
        .back-btn {
            background: none;
            border: none;
            color: white;
            padding: 0 15px;
            font-size: 16px;
            cursor: pointer;
        }
        .header-title {
            flex: 1;
            text-align: center;
            font-size: 18px;
            margin-right: 45px;
        }
        .main-content {
            flex: 1;
            padding: 15px;
            padding-bottom: 20px;
        }
        .card {
            background: white;
            border-radius: 8px;
            margin-bottom: 15px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        .card-header {
            padding: 15px;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .status-badge {
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            background-color: #f5f5f5;
        }
        .status-pending { color: var(--warning-color); }
        .status-paid { color: var(--primary-color); }
        .status-shipped { color: var(--success-color); }
        .status-completed { color: var(--success-color); }
        .status-cancelled { color: #999; }

        .card-content {
            padding: 15px;
        }
        .info-row {
            display: flex;
            margin-bottom: 10px;
            font-size: 14px;
            line-height: 1.5;
        }
        .info-label {
            color: #666;
            width: 80px;
            flex-shrink: 0;
        }
        .info-value {
            flex: 1;
            color: #333;
        }
        .product-item {
            display: flex;
            padding: 10px 0;
            border-bottom: 1px solid var(--border-color);
        }
        .product-item:last-child {
            border-bottom: none;
        }
        .product-image {
            width: 80px;
            height: 80px;
            border-radius: 4px;
            margin-right: 12px;
            background-color: #f8f8f8;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .product-image img {
            max-width: 100%;
            max-height: 100%;
        }
        .product-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        .product-name {
            font-size: 14px;
            color: #333;
            margin-bottom: 4px;
        }
        .product-spec {
            font-size: 12px;
            color: #999;
            margin-bottom: 4px;
        }
        .product-price-qty {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .product-price {
            color: #ff6b6b;
            font-size: 14px;
        }
        .product-quantity {
            color: #999;
            font-size: 13px;
        }
        .amount-row {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            padding: 10px 15px;
            font-size: 14px;
            border-top: 1px solid var(--border-color);
        }
        .amount-label {
            color: #666;
            margin-right: 8px;
        }
        .amount-value {
            color: #ff6b6b;
            font-weight: 500;
            font-size: 16px;
        }
        .timeline {
            padding: 0 15px 15px;
        }
        .timeline-item {
            position: relative;
            padding-left: 20px;
            padding-bottom: 15px;
        }
        .timeline-item:last-child {
            padding-bottom: 0;
        }
        .timeline-item::before {
            content: '';
            position: absolute;
            left: 0;
            top: 6px;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: var(--primary-color);
        }
        .timeline-item::after {
            content: '';
            position: absolute;
            left: 3px;
            top: 14px;
            width: 2px;
            height: calc(100% - 14px);
            background-color: #e8e8e8;
        }
        .timeline-item:last-child::after {
            display: none;
        }
        .timeline-time {
            font-size: 12px;
            color: #999;
            margin-bottom: 4px;
        }
        .timeline-content {
            font-size: 14px;
            color: #333;
        }
        .action-bar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 10px 15px;
            background: white;
            box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }
        .btn {
            padding: 8px 16px;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            border: 1px solid currentColor;
            background: none;
        }
        .btn-primary {
            color: var(--primary-color);
        }
        .btn-warning {
            color: var(--warning-color);
        }
    </style>
</head>
<body>
    <div class="header">
        <button class="back-btn" onclick="history.back()">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="header-title">订单详情</div>
    </div>

    <div class="main-content">
        <div class="card">
            <div class="card-header">
                <span>订单号：2025063002</span>
                <span class="status-badge status-paid">待发货</span>
            </div>
            <div class="card-content">
                <div class="info-row">
                    <span class="info-label">下单时间：</span>
                    <span class="info-value">2025-06-30 14:30:25</span>
                </div>
                <div class="info-row">
                    <span class="info-label">支付方式：</span>
                    <span class="info-value">微信支付</span>
                </div>
                <div class="info-row">
                    <span class="info-label">支付时间：</span>
                    <span class="info-value">2025-06-30 14:35:18</span>
                </div>
            </div>
        </div>

        <div class="card">
            <div class="card-header">收货信息</div>
            <div class="card-content">
                <div class="info-row">
                    <span class="info-label">收货人：</span>
                    <span class="info-value">张三</span>
                </div>
                <div class="info-row">
                    <span class="info-label">联系电话：</span>
                    <span class="info-value">138****8888</span>
                </div>
                <div class="info-row">
                    <span class="info-label">收货地址：</span>
                    <span class="info-value">广东省深圳市南山区科技园南区8栋3单元303室</span>
                </div>
            </div>
        </div>

        <div class="card">
            <div class="card-header">商品信息</div>
            <div class="card-content">
                <div class="product-item">
                    <div class="product-image">
                        <img src="../images/dress.svg" alt="连衣裙">
                    </div>
                    <div class="product-info">
                        <div>
                            <div class="product-name">时尚连衣裙</div>
                            <div class="product-spec">颜色：粉色 尺码：M</div>
                        </div>
                        <div class="product-price-qty">
                            <span class="product-price">¥299.00</span>
                            <span class="product-quantity">×2</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="amount-row">
                <span class="amount-label">实付金额：</span>
                <span class="amount-value">¥598.00</span>
            </div>
        </div>

        <div class="card">
            <div class="card-header">订单跟踪</div>
            <div class="timeline">
                <div class="timeline-item">
                    <div class="timeline-time">2025-06-30 14:35:18</div>
                    <div class="timeline-content">买家已付款</div>
                </div>
                <div class="timeline-item">
                    <div class="timeline-time">2025-06-30 14:30:25</div>
                    <div class="timeline-content">买家已下单</div>
                </div>
            </div>
        </div>
    </div>

    <div class="action-bar">
        <button class="btn btn-warning" onclick="cancelOrder()">取消订单</button>
        <button class="btn btn-primary" onclick="shipOrder()">发货</button>
    </div>

    <script>
    // 获取URL中的订单号参数
    function getOrderNumber() {
        const urlParams = new URLSearchParams(window.location.search);
        return urlParams.get('order');
    }

    // 页面加载时获取订单信息
    window.onload = function() {
        const orderNumber = getOrderNumber();
        if (orderNumber) {
            // 更新页面上的订单号
            document.querySelector('.card-header span').textContent = '订单号：' + orderNumber;
            
            // 根据订单号判断是否显示操作按钮
            const actionBar = document.querySelector('.action-bar');
            if (orderNumber === '2025063001') {
                // 待付款订单显示取消和付款按钮
                actionBar.innerHTML = `
                    <button class="btn btn-warning" onclick="cancelOrder()">取消订单</button>
                    <button class="btn btn-primary" onclick="payOrder()">立即付款</button>
                `;
            } else if (orderNumber === '2025063002') {
                // 待发货订单显示发货按钮
                actionBar.innerHTML = `
                    <button class="btn btn-primary" onclick="shipOrder()">发货</button>
                `;
            }
        }
    }

    function cancelOrder() {
        const orderNumber = getOrderNumber();
        if (confirm('确认要取消该订单吗？')) {
            // 这里添加取消订单的逻辑
            alert('订单已取消');
            history.back();
        }
    }

    function payOrder() {
        const orderNumber = getOrderNumber();
        // 这里添加支付订单的逻辑
        alert('跳转到支付页面...');
    }

    function shipOrder() {
        const orderNumber = getOrderNumber();
        // 跳转到发货页面
        window.location.href = 'order-ship.html?order=' + orderNumber;
    }
    </script>
</body>
</html>